import request from "../../utils/request";
import { GoodsInfoResponse, HotRecommendResponse, GoodsCommentResponse, CommentDetailResponse } from "./type";
import API from "../api";


// 获取商品详细
export const reqGoodsInfo = (id: string) => request.get<any, GoodsInfoResponse>(API.GOODSINFO + `?id=${id}`)


// 获取热榜
export const reqHotRecommend = (id: string, limit: number, type: number) => request.get<any, HotRecommendResponse>(API.HOTRECOMMEND + `?id=${id}&limit=${limit}&type=${type}`)

// 获取商品评论
export const reqGoodsComment = (id: string) => request.get<any, GoodsCommentResponse>(`/goods/${id}/evaluate`)

// 评论分页数据
export const reqCommentDetail = (
    id: string,
    page: number = 1,
    pageSize: number = 10,
    hasPicture: boolean = false
) => request.get<any, CommentDetailResponse>(
    `/goods/${id}/evaluate/page?page=${page}&pageSize=${pageSize}&hasPicture=${hasPicture}`)
